package com.itheima;

public class RealBankAccount implements BankAccount {
    // 余额
    private double balance;

    @Override
    public void deposit(double amount) {
        balance += amount;
    }

    @Override
    public void withdraw(double amount) {
        if (amount <= balance) {
            balance -= amount;
            System.out.printf("提现 ¥%s 成功%n", amount);
        } else {
            System.out.printf("提现 ¥%s 失败，资金不足，当前余额 ¥%s%n", amount, balance);
        }
    }

    @Override
    public double getBalance() {
        return balance;
    }
}
